﻿using DMTroube_ZeKer.Control;
using Microsoft.Web.WebView2.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DMTroube_ZeKer.View.ToolView
{
    public partial class TopNation : UserControl
    {
        /// <summary>
        /// 导航地址
        /// </summary>
        public string UrlName
        {
            set
            {
                txtUrl.Text = value;
            }
        }
        private MainWebView _webView;
        public TopNation(MainWebView webView)
        {
            InitializeComponent();
            _webView = webView;
            _webView.NavigateStarting += WebView_NavigateStarting;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string url = txtUrl.Text;
            if (url != "")
            {
                if (_webView != null)
                    _webView.Url = url;
            }
        }
        private void WebView_NavigateStarting(object? arg1, Microsoft.Web.WebView2.Core.CoreWebView2NavigationStartingEventArgs arg2)
        {
            UrlName = arg2.Uri.ToString();
        }
    }
}
